#include "Complex.h"
Complex::Complex()
{
this->real=0.0;
this->imag=0.0;
}
Complex::Complex(double real, double imag)
{
this->real=real;
this->imag=imag;
}
double Complex::getReal()
{
return this->real;
}
double Complex::getImag()
{
return this->imag;
}
void Complex::setReal(double real)
{
this->real=real;
}
void Complex::setImag(double imag)
{
this->imag=imag;
}
Complex Complex::operator++(){
double real;
double imag;
real=(*this).real+1.0;
imag=(*this).imag+1.0;
Complex s=Complex(real,imag);
return s;
}

ostream& operator<<(ostream& afiseaza, const Complex& c)
{
afiseaza<<"Parte reala:"<<c.real<<"\nParte imaginara:"<<c.imag<<"\n";
return afiseaza;
}
sirComplex::sirComplex(Complex v[100])
{
for (int i=0;i<100;i++)
this->v[i]=v[i];
}
void sirComplex::setElement(Complex c, int i)
{
this->v[i]=c;
}
Complex sirComplex::getElement(int i)
{
return this->v[i];
}
int sirComplex::nrElemente()
{
int i=0;
for (i=0;i<100;i++) 
if ((this->getElement(i).getReal()==0.0)&&(this->getElement(i).getImag()==0.0)) return i;
return i;
}
double sirComplex::suma()
{
double s=0,n;
n=this->nrElemente();
for (int i=0; i<n; i++) s+=this->getElement(i).getReal()+this->getElement(i).getImag();
return s;
}
void sirComplex::incrementare()
{
int n;
Complex c;
n=this->nrElemente();
for (int i=0; i<n; i++) 
if (this->getElement(i).getImag()==0.0) 
{
c=Complex(this->getElement(i).getReal(),this->getElement(i).getImag());
++c;
this->setElement(c,i);
}
}


